package ordinary;

/**
 * @Author Big_white
 * @Date 2021/11/19
 */
/*
*核心类
* 1.包含新的天气情况信息
* 2.她包含CurrentConditions对象
* 3.当数据有更新时，就主动调用update方法
* */
public class WeatherData {
    private float temperature;
    private float pressure;
    private float humidity;
    private CurrentConditions currentConditions;
    public WeatherData(CurrentConditions currentConditions){
        this.currentConditions=currentConditions;
    }

    public float getTemperature() {
        return temperature;
    }

    public float getPressure() {
        return pressure;
    }

    public float getHumidity() {
        return humidity;
    }
    public void dataChange(){
        currentConditions.update(getTemperature(),getPressure(),getHumidity());
    }
    public void setData(float temperature,float pressure,float humidity){
        this.temperature=temperature;
        this.pressure=pressure;
        this.humidity=humidity;
        dataChange();
    }
}
